using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Domain
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class EmailAddressAttribute : RegularExpressionAttribute
    {
        public EmailAddressAttribute() : base(@"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*@((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$") { }

    }


    //[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    //public class EmailAddressAttribute : ValidationAttribute
    //{


    //    protected override ValidationResult IsValid(object value, ValidationContext validationContext)
    //    {
    //        if (value == null)
    //            return ValidationResult.Success;

    //        if (value.ToString().Contains("@"))
    //            return ValidationResult.Success;

    //        else
    //            return new ValidationResult("missing @");


    //    }
    //}
}
